<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
    <title>axios发送ajax请求基本用法</title>
</head>
<body>
	<div id="app">
		<button @click="send">发送ajax请求</button>
	</div>

</body>
</html>

<script src="./vue.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script type="text/javascript">
	
new Vue({
	 el:"#app",
	 methods:{
	 	send:function(){
	 		console.log(999)

	 		// axios.get('index.php',{
	 		// 	params:{key:"hshs"}
	 		// }).then(function(res){
	 		// 	console.log(res)
	 		// }).catch(function(error){
	 		// 	console.log(error)
	 		// })
	 		axios.post('index.php',{
	 			firstName: {"key":'Fred',"key2":"haha"},        // 参数 firstName
    			lastName: 'Flintstone'    // 参数 lastName

	 		},{headers: { 'content-type': 'application/x-www-form-urlencoded' }}).then(function(res){
	 			console.log(res)
	 		}).catch(function(error){
	 			console.log(error)
	 		})
	 			
	 	}
	 }

})




</script>